package com.yusvn.scm.admin.controller;

import com.alibaba.fastjson.JSONObject;
import com.jfinal.aop.Inject;
import com.jfinal.ext.cors.EnableCORS;
import com.yusvn.scm.admin.service.AdminDictService;
import com.yusvn.scm.common.BaseController;
import com.yusvn.scm.common.kit.RetKit;

/**
 * 字典管理
 * @author liugz
 *
 */
@EnableCORS
public class AdminDictController extends BaseController{

	@Inject
	AdminDictService srv;
	

	public void page() {
		
	}
	
	public void get() {
		renderJson(RetKit.ok().setData(srv.get(getPara("dictId") ) ));
	}

	public void list() {
		renderJson(RetKit.ok().setData( JSONObject.toJSON(srv.list()) ));
	}
	
	public void add() {
		renderJson(srv.save(getRawData()));
	}

	public void update() {
        renderJson(srv.update(getRawData()));
	}

	public void remove() {
		renderJson(srv.remove(getPara("id")));
	}

	public void removeBatch() {		
		renderJson(srv.removeBatch(getRawData() ) );
	}
	
}
